class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int n = nums[0];
        for (int i = 1; i < nums.size(); i++) {
            while ((nums[i] == n) && (i < nums.size())) {
                nums.erase(nums.begin() + i);
            }
            n = nums[i];
        }

        return nums.size();
    }
};